﻿<localView:UserControlBase x:Class="VocabManager.View.ItemViewModeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"                     
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:localView="clr-namespace:VocabManager.View"
                          
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Hold="LayoutRoot_Hold">
        <toolkit:GestureService.GestureListener>
            <toolkit:GestureListener Flick="OnFlick"/>
        </toolkit:GestureService.GestureListener>
        <Grid.Resources>
            <localView:StringToVisibilityConverter x:Key="visibilityConverter"></localView:StringToVisibilityConverter>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>

        <Grid  Name="bdFront">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition></RowDefinition>

            </Grid.RowDefinitions>
            <ContentControl FontSize="15" Foreground="#FFE7FD1E" Padding="5" Content="Front" Style="{StaticResource TitleStyle}" ></ContentControl>
            <ContentControl  
                            
                            Grid.Row="1" Style="{StaticResource Body}" Content="{Binding Path=FrontText}"></ContentControl>

            <Border Grid.Row="1" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Top"  >
                <Grid>
                    <TextBlock Text="{Binding Index}"  FontSize="25" VerticalAlignment="Center" HorizontalAlignment="Center"
                       
                      Foreground="LightGray" FontWeight="Bold"
                       ></TextBlock>
                    <Ellipse StrokeThickness="3" Height="50" Width="50" Stroke="Blue"> </Ellipse>
                </Grid>
            </Border>
        </Grid>


        <Grid  Name="bdBack">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="3*"></RowDefinition>


            </Grid.RowDefinitions>
            <Grid  >
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition></RowDefinition>

                </Grid.RowDefinitions>
                <ContentControl  Style="{StaticResource TitleStyle}" FontSize="15" Padding="5" Content="Front" ></ContentControl>

                <ContentControl FontSize="20" Foreground="Black" HorizontalContentAlignment="Center"
                             Grid.Row="1" Style="{StaticResource Body}" Content="{Binding Path=FrontText}"></ContentControl>

            </Grid>
            <Grid Grid.Row="1" >
            <ContentControl Style="{StaticResource TitleStyle}" FontSize="20" Padding="5" Content="Back" ></ContentControl>
                <Button Padding="7" Content="Play" Name="btnPlay"  Click="btnPlay_Click"
                        Visibility="{Binding Path=BackSound,Converter={StaticResource visibilityConverter}}" HorizontalAlignment="Left" Foreground="White" FontSize="30" Margin="5"></Button>

            </Grid>
            <ContentControl 
                    Foreground="White"  FontSize="40"      Grid.Row="2" Style="{StaticResource Body}" Content="{Binding Path=BackText}"></ContentControl>

        </Grid>
        <Border Grid.Row="2" BorderBrush="Black" BorderThickness="1" Background="Black" Opacity="1" >
            <Button Padding="10" Foreground="White" Margin="12" Grid.Row="2" Command="{Binding ChangeSideCommand}" Content="Turn Card"   ></Button>
        </Border>
    </Grid>

    <localView:UserControlBase.Projection>
        <PlaneProjection x:Name="planeProjection"
                         CenterOfRotationX="0" />
    </localView:UserControlBase.Projection>
    <localView:UserControlBase.Triggers>
        <!--<EventTrigger>
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="LayoutRoot"
                                     Storyboard.TargetProperty="Opacity"
                                     From=".5" To="1" Duration="0:0:1" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>-->
      
            <EventTrigger>
                <BeginStoryboard>
                    <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="planeProjection"
                                     Storyboard.TargetProperty="RotationY"
                                     From="200" To="0" Duration="0:0:0.5" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
       
    </localView:UserControlBase.Triggers>
</localView:UserControlBase>
